import axios from '@/utils/axios';

export const getList = data =>
  axios.post(`/bnd-uaac/v3/uaacRoleManage/roleUserList/${data.pageNumber}/${data.pageSize}`, data);

export const rolesAdd = data => axios.post('/bnd-uaac/v3/uaacRoleManage/roles/add', data);

export function rolesUpdate(data) {
  return axios.request({
    url: '/bnd-uaac/v2/uaacRoleManage/roles/update',
    method: 'put',
    data: data,
    headers: { authGroup: 417 },
  });
}

export const rolesTree = data => axios.post('/bnd-uaac/v2/uaacRoleManage/roles/tree/select', data);

export function rolesManage(data) {
  return axios.request({
    url: '/bnd-uaac/v2/uaacRoleManage/roles/manage',
    method: 'put',
    data: data,
    headers: { authGroup: 417 },
  });
}

export function accountsManage(data) {
  return axios.request({
    url: '/bnd-uaac/v2/uaacAdministratorManage/accounts/manage',
    method: 'put',
    data: data,
    headers: { authGroup: 417 },
  });
}

export function accountsHandle(data) {
  return axios.request({
    url: '/bnd-uaac/v3/uaacAdministratorManage/accounts/handle',
    method: 'put',
    data: data,
    headers: { authGroup: 417 },
  });
}

export const getAllAdminUser = data => axios.post('/bnd-uaac/uaacUser/getAllAdminUser', data);

export const findByRoleId = ({ roleId, orgId }) =>
  axios.get(`/bnd-uaac/v3/uaacAdministratorManage/accounts/findByRoleId/${roleId}/${orgId}`);

// 分配权限
export function rolesAllotAuth(data) {
  return axios.request({
    url: '/bnd-uaac/v2/uaacRoleManage/roles/allotAuth',
    method: 'put',
    data: data,
    headers: { authGroup: 417 },
  });
}
//判断企业是否认证
export const findCompanyInfoAuthenticationById = organizationId =>
  axios.get(`/bnd-organization/organization/findCompanyInfoAuthenticationById/${organizationId}`);
